<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE html
        PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core">



<h:body>
    <h:form id="addProjectDialogForm">
        <p:growl id="growl" showDetail="true" life="3000"/>
        <h:panelGrid columns="2" cellpadding="10">
            <h:outputLabel for="project_name" value="Введите название проекта: "/>
            <p:inputText id="project_name" value="#{projectBean.project.name}" required="true">
                <f:validateLength minimum="2"/>
            </p:inputText>

            <h:outputLabel for="project_full_name" value="Введите полное название проекта: "/>
            <p:inputText id="project_full_name" value="#{projectBean.project.fullName}" required="true">
                <f:validateLength minimum="2"/>
            </p:inputText>

            <h:outputLabel value="Выбирете заказчика: "/>
            <p:selectOneMenu value="#{projectBean.customer.name}" effect="fold" >
                <f:selectItem itemLabel="Выберите заказчика" itemValue="" />
                <f:selectItems value="#{projectBean.customerList}" />
            </p:selectOneMenu>

            <h:outputText  value="Введите местоположение проекта: "/>
            <p:selectOneMenu value="#{projectBean.location.name}" effect="fold" >
                <f:selectItem itemLabel="Выберите метоположение" itemValue="" />
                <f:selectItems value="#{projectBean.locationList}" />
            </p:selectOneMenu>

            <h:outputLabel for="project_address" value="Введите адрес проекта: "/>
            <p:inputText id="project_address" value="#{projectBean.project.address}" required="true"/>

            <h:outputLabel for="project_total" value="Введите стоимость проекта: "/>
            <p:inputText id="project_total" value="#{projectBean.projectCustomerId.total}" required="true"/>

            <h:outputLabel for="project_start_date" value="Введите дату старта проекта: "/>
            <p:calendar value="#{projectBean.projectCustomerId.startDate}" id="project_start_date" showButtonPanel="true"/>

            <h:outputLabel for="project_end_date" value="Введите дату сдачи проекта: "/>
            <p:calendar value="#{projectBean.projectCustomerId.endDate}" id="project_end_date" showButtonPanel="true"/>

            <h:outputLabel for="customer_description" value="Описание проекта: "/>
            <p:inputTextarea id="customer_description" value="#{projectBean.project.description}" rows="5"
                             cols="20"/>

            <f:facet name="footer">
                <p:commandButton id="saveButton" value="Сохранить" update="growl" actionListener="#{projectBean.saveProject}"
                        oncomplete="handleCreateProjectRequest(xhr, status, args)" />
            </f:facet>
        </h:panelGrid>
    </h:form>
</h:body>

</html>